#ifndef __kraw__ObjectNode_h__
#define __kraw__ObjectNode_h__
/**
	@class ObjectNode

*/

#include <vector>
#include <string>

namespace kraw
{
	class ObjectNode //: public EventListener, public EventDispatcher
	{
	public:
		ObjectNode();

		virtual void addChild(ObjectNode* child);
		virtual void addChildAt(ObjectNode* child, int index);
		virtual void removeChild(ObjectNode* child);
		virtual void deleteChild(ObjectNode *child);

		ObjectNode* findChildByName(const std::string& name);
		ObjectNode* getChildAt(int index);
		int getChildCount();

		virtual void release();

		virtual void logicUpdate();

		ObjectNode* getParent();

		void setName(const std::string& name);
		const std::string& getName();


	protected:

		virtual void logicTraversal();

		std::string name;

		ObjectNode* parent;
		std::vector<ObjectNode*> children;

		void deleteTraversal();
		static void deletePendingNodes();
		static std::vector<ObjectNode*> toDelete;
	};
}

#endif
